<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<jsp:include page="../inc.jsp"></jsp:include>
	<jsp:include page="../head.jsp"/>
<meta http-equiv="X-UA-Compatible" content="edge" />
<title>业务报表</title>
<style>
	input{
			width:120px;
			height:18px;
			border:1px solid #77b2e0;
			border-radius: 3px;
		}
	select{
		height:20px;
		border:1px solid #77b2e0;
		border-radius: 3px;
	}
	.searchBox{
		width:1100px; 
		height:50px;
		margin-top:15px;
	}
	.searchBox li{
		float:left;
		margin-left:3px;
	}
	.tableOntab td{
		height:37px;
		border-right:none;
	}
	.tableOntab .borderNone{
		border-bottom:none;
	}
	.mynewBtn{
		margin-left:90px;
	}
	.query{
		display:inline-block;
	}
</style>
<script type="text/javascript">
$(function(){
	//加载表格信息
	dataGrid = $('#table').datagrid({
		url:'${ctx}/tradeList/purRepManage?temp='+Math.random(),
		width:1600,
		striped : true,
		singleSelect : true,
		idField : 'flightIdList',
		pageList : [10,20,30,40,50],
		//sortName : 'id',
		//sortOrder : 'asc',
		method : 'get',
		toolbar:'#toolbar',
		pagination:true,
		
		columns:[[
		{
			width : '80',
			title : 'id',
			field : 'id',
			hidden : true,
			sortable : true
		},{
			width : '150',
			title : '支付单号',
			align : 'center',
			field : 'payOrderNumber',
		},{
			width : '135',
			title : '采购商',
			align : 'center',
			field : 'organizationName',
		},{
			width : '130',
			title : '类型',
			align : 'center',
			field : 'cc',
			formatter : function(value,row){
				var str=CommonConverter.toTradeType(row.tradeType);
				return str;
			}
		},{
			width : '100',
			title : '金额',
			align : 'center',
			field : 'aa',
			formatter:function(value,row){
				var str=row.cost;
				if(row.tradeType == 3){
					str=row.income;
				};
				return str;
			}
		},{
			width : '120',
			title : '操作日期',
			align:'center',
			field : 'createTime',
		},{
			width : '100',
			title : '账户金额（CNY）',
			align:'center',
			field : 'a',
			formatter:function(value,row){
				var str=CommonConverter.toZero(row.accountBalance);
				return str;
			}
		},{
			width : '100',
			title : '可用金额',
			align:'center',
			field : 'dd',
			formatter:function(value,row){
				var str=CommonConverter.toZero(row.availableBalance);
				return str;
			}
		},{
			width : '100',
			title : '冻结金额',
			align:'center',
			field : 'freezeAmount',
		}
		] ]
	});
	//点击查询 重新加载列表
	$("#query").click(function(){
		//获取参数
		var organizationName=$("#organizationName").val();
		var startDate=$("#_startTime").datebox('getValue');
		var endDate=$("#_endTime").datebox('getValue');
		var tradeType=$("#tradeType").val();
		$('#table').datagrid('load',{"organizationName":organizationName,"startDate":startDate,"endDate":endDate,"tradeType":tradeType,"temp":Math.random()});
	});
});
//导出表格
function exportExcel(){
	var organizationName=$("#organizationName").val();
	var startDate=$("#_startTime").datebox('getValue');
	var endDate=$("#_endTime").datebox('getValue');
	var tradeType=$("#tradeType").val();
	var url = "${ctx}/excel/exportSheets1?organizationName="+organizationName
			+"&startDate="+startDate
			+"&endDate="+endDate
			+"&tradeType"+tradeType
			+"&temp="+Math.random();
	window.location.href = url;
};

</script>
</head>
<body>
	<div>
		<div>
			<ul class="searchBox">
				<li>采购商：
					<input type="text" id="organizationName">
				</li>
				<li>
					操作日期 ：<input class="easyui-datebox" id="_startTime" style="width: 120px" />
					至<input class="easyui-datebox" id="_endTime" style="width: 120px" /></li>
				<li>
				<li>类型：
					<select id="tradeType">
						<option value="">全部</option>
						<option value="0">票款</option>	
						<option value="1">冻结</option>
						<option value="2">提现</option>
						<option value="3">充值</option>
						<option value="4">解冻</option>
					</select>
				</li>
				<li>
					<button class='query' id="query">查询</button>
					<button class='query' onclick="exportExcel()">导出</button>
				</li>
			</ul>
		</div>
		<div>
				<table id="table" class="easyui-datagrid"></table>
		</div>
	</div>
<jsp:include page="../footer.jsp"/>
</body>
</html>